package com.key.puzzlemodel.view

import android.content.Context
import android.util.AttributeSet
import android.widget.RelativeLayout

/**
 * 正方形RelativeLayout
 */
class SquareRelativeLayout : RelativeLayout {

    constructor(context: Context) : super(context)
    constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
    constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)

    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        val size = widthMeasureSpec.coerceAtMost(heightMeasureSpec)
        super.onMeasure(size, size)
    }
}